home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 429_01 / chess12 / log.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1994-03-25  |  415 b   |  28 lines

  1. #include <dos.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4.  
  5. void log (char *msg)
  6.   {
  7.     union REGS r;
  8.  
  9.     FILE *fp = fopen("out","a");
  10.  
  11.     fputs(msg, fp);
  12.     fputc('\n', fp);
  13.  
  14.     fclose(fp);
  15.  
  16.     // check if ESC key pressed
  17.     r.h.ah = 1;
  18.     int86(0x16, &r, &r);
  19.     if (r.x.flags & 1)
  20.       {
  21.     r.h.ah = 0;
  22.     int86(0x16, &r, &r);
  23.     if (r.h.al == 27)
  24.       exit(1);
  25.       }
  26.     return;
  27.   }
  28.